package com.easy.slurm.controller;

import com.easy.slurm.slurm.api.SlurmApi;
import com.easy.slurm.slurm.bean.SInfo;
import com.easy.slurm.vo.ResultVo;
import com.jcraft.jsch.JSchException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * @author bing.bai
 * @create 2025/6/5
 */
@Slf4j
@RestController
@RequestMapping("slurm/nodes")
public class NodeController {

    @Autowired
    private SlurmApi slurmApi;

    /**
     * 查看系统资源
     * @return
     * @throws JSchException
     * @throws IOException
     */
    @GetMapping("/sinfo")
    public ResultVo sinfo() throws JSchException, IOException {
        List<SInfo> sinfo = slurmApi.sinfo();
        return ResultVo.data(sinfo);
    }




}
